import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '创建日期',
    align:"center",
    sorter: true,
    dataIndex: 'createTime'
   },
   {
    title: '分类',
    align:"center",
    dataIndex: 'esClassify',
    customRender: ({ text }) => {
      return render.renderDict(text, 'esClassify');
    },
   },
   {
    title: '消息标题',
    align:"center",
    dataIndex: 'esTitle'
   },
   {
    title: '消息方式',
    align:"center",
    dataIndex: 'esType',
    customRender: ({ text }) => {
      return !text?'':text=='2'?'邮箱':'公众号';
    },
   },
   {
    title: '接收人',
    align:"center",
    dataIndex: 'esReceiver'
   },
   {
    title: '参数',
    align:"center",
    dataIndex: 'esParam'
   },
   {
    title: '内容',
    align:"center",
    dataIndex: 'esContent'
   },
   {
    title: '推送时间',
    align:"center",
    dataIndex: 'esSendTime'
   },
   {
    title: '推送状态',
    align:"center",
    dataIndex: 'esSendStatus',
    customRender: ({ text }) => {
      return render.renderDict(text, 'esSendStatus');
    },
   },
   {
    title: '次数',
    align:"center",
    dataIndex: 'esSendNum'
   },
   {
    title: '推送失败原因',
    align:"center",
    dataIndex: 'esResult'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
   
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "创建日期",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "接收人",
      field: 'esReceiver',
      component: 'Input',
      //colProps: {span: 6},
 	},
     {
      label: "推送时间",
      field: "esSendTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "推送状态",
      field: 'esSendStatus',
      component: 'JDictSelectTag',
      componentProps:{
       dictCode:"esSendStatus",
      }
      //colProps: {span: 6},
 	},
	{
      label: "分类",
      field: 'esClassify',
      component: 'JDictSelectTag',
      componentProps:{
       dictCode:"esClassify",
      }
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '消息标题',
    field: 'esTitle',
    component: 'Input',
  },
  {
    label: '消息方式',
    field: 'esType',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"esType"
     },
  },
  {
    label: '接收人',
    field: 'esReceiver',
    component: 'Input',
  },
  {
    label: '参数',
    field: 'esParam',
    component: 'Input',
  },
  {
    label: '内容',
    field: 'esContent',
    component: 'Input',
  },
  {
    label: '推送时间',
    field: 'esSendTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '推送状态',
    field: 'esSendStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"esSendStatus"
     },
  },
  {
    label: '次数',
    field: 'esSendNum',
    component: 'InputNumber',
  },
  {
    label: '推送失败原因',
    field: 'esResult',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '分类',
    field: 'esClassify',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"esClassify"
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  createTime: {title: '创建日期',order: 0,view: 'datetime', type: 'string',},
  esTitle: {title: '消息标题',order: 1,view: 'text', type: 'string',},
  esType: {title: '消息方式',order: 2,view: 'text', type: 'string',},
  esReceiver: {title: '接收人',order: 3,view: 'text', type: 'string',},
  esParam: {title: '参数',order: 4,view: 'text', type: 'string',},
  esContent: {title: '内容',order: 5,view: 'text', type: 'string',},
  esSendTime: {title: '推送时间',order: 6,view: 'datetime', type: 'string',},
  esSendStatus: {title: '推送状态',order: 7,view: 'list', type: 'string',},
  esSendNum: {title: '次数',order: 8,view: 'number', type: 'number',},
  esResult: {title: '推送失败原因',order: 9,view: 'text', type: 'string',},
  remark: {title: '备注',order: 10,view: 'text', type: 'string',},
  esClassify: {title: '分类',order: 11,view: 'list', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
